using System;
using System.Collections.Generic;
using PhillyCodeCamp.Mappers;
using PhillyCodeCamp.Services;

namespace PhillyCodeCamp.Infrastructure
{
    public class ApplicationStartupCommand
    {
        public void Execute ()
        {
            DependencyResolver.InitializeWith(new SimpleDependencyResolver(DefineDependencies()));
        }

        private static IDictionary<Type, object> DefineDependencies()
        {
            var dependencies = new Dictionary<Type, object>();

            dependencies.Add(typeof(ILogger), new NullLogger());
            dependencies.Add(typeof(IExceptionHandler),
                new ExceptionHandler(new HttpContextProvider(), new NullLogger()));
            dependencies.Add(typeof(IContextProvider), new HttpContextProvider());

            dependencies.Add(typeof(ITaxRateService), new TaxRateService());
            dependencies.Add(typeof(ITaxReturnMapper), new TaxReturnMapper(new TaxRateService()));
            dependencies.Add(typeof(IValidationService), new ValidationService(new TaxReturnMapper(new TaxRateService())));
            dependencies.Add(typeof(ITaxService), new TaxService(new TaxReturnMapper(new TaxRateService())));


            return dependencies;
        }

    }
}